package blue.mqtt4j.core.lexer;

/**
 * @author Jin Zheng
 * @since 1.0 2020-10-20
 */
public class LexerMain
{
	public LexerMain()
	{
	}

	public static void main(String[] args)
	{
		SimpleLexer lexer = new SimpleLexer();
		String code = "age >= 45";
		print(code, lexer.tokenize(code));

		code = "int age = 45";
		print(code, lexer.tokenize(code));

		code = "2 + 3 * 5";
		print(code, lexer.tokenize(code));
	}

	private static void print(String code, TokenReader reader)
	{
		System.out.printf("code: %s\n", code);
		for (Token token : reader.tokens())
		{
			System.out.printf("%s: %s\n", token.getType(), token.getText());
		}
		System.out.println("===================================");
	}

}
